package com.xfg.domain.strategy.model.entity;

import com.xfg.domain.strategy.model.valobj.RuleLogicCheckTypeV0;
import lombok.*;

/**
 * 规则动作实体
 *定义了一个泛型类 RuleActionEntity，其类型参数 T 必须是 RaffleEntity 或其子类。
 * 用于封装抽奖过程中不同阶段的动作实体。
 * @author Fuzhengwei bugstack.cn @小傅哥
 * @description 规则动作实体
 * @create 2024-01-06 15:51
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class RuleActionEntity<T extends RuleActionEntity.RaffleEntity> {

    private String code= RuleLogicCheckTypeV0.ALLOW.getCode();
    private String info= RuleLogicCheckTypeV0.TAKE_OVER.getInfo();

    private String ruleModel;

    private T data;

    static public class RaffleEntity { }


    @EqualsAndHashCode(callSuper = true)
    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    static public class RaffleBeforeEntity extends RaffleEntity {
        /**
         * 策略ID
         */
        private Long strategyId;

        /**
         * 权重值Key；用于抽奖时可以选择权重抽奖。
         */
        private String ruleWeightValueKey;

        /**
         * 奖品ID
         * 如果是黑名单 直接返回奖品给你就行了
         */
        private Integer awardId;
    }

    // 抽奖之中
    static public class RaffleCenterEntity extends RaffleEntity {
    }
    // 抽奖之后
    static public class RaffleAfterEntity extends RaffleEntity {
    }
}
